<template>
	<view>
		<view class="main">
			<!-- <view class="shuru">
				<text class="shuru_tit t1">商户头像</text>
				<view class="shuru_image">
					<image class="image" mode="aspectFill"></image>
				</view>
			</view> -->
			<view class="shuru">
				<text class="shuru_tit t1">商户名称</text>
				<text class="shuru_text t1">{{dpname}}</text>
			</view>

			<view class="shuru">
				<text class="shuru_tit t1">店铺所属地区</text>
				<text class="shuru_text t1">{{dpdq}}</text>
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">店铺地址</text>
				<text class="shuru_text t1">{{dpadr}}</text>
			</view>
			<view class="shuru">
				<text class="shuru_tit t1">店铺法人</text>
				<text class="shuru_text t1">{{name}}</text>
			</view>

			<view class="shuru">
				<text class="shuru_tit t1">联系方式</text>
				<text class="shuru_text t1">{{tel}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mainid: '',
				imageSrc: '',
				ids: '',
				dpname: '',
				dpdq: '',
				dpadr: '',
				name: '',
				tel: '',
			}
		},
		onLoad(opt) {
			// console.log(opt);
			var _this = this;
			_this.ids = opt.id;
			uni.getStorage({
				key: 'user',
				success: function(res) {
					_this.mainid = res.data.id;
					_this.yyzz();
					_this.dpinfo();
				}
			});
		},
		methods: {
			dpinfo() {
				var that = this;
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/getInfo/' + that.ids, //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						id: that.ids
					},
					success: (res) => {
						uni.hideLoading(); //关闭加载动画
						console.log(res);
						if (res.data.status == '200') {
							that.tel = res.data.data.phone;
						}
					},
					fail: (error) => {
						// this.checks = true
						console.log(error)
					}
				});
			},
			yyzz() {
				var that = this;
				uni.request({
					header: {
						'Content-Type': 'application/x-www-form-urlencoded', //自定义请求头信息
					},
					url: getApp().globalData.url + 'mch/getSubject/' + that.ids, //仅为示例，并非真实接口地址。
					method: 'POST',
					data: {
						id: that.ids
					},
					success: (res) => {
						uni.hideLoading(); //关闭加载动画
						console.log(res);
						if (res.data.status == '200') {
							that.dpname = res.data.data.mchName;
							that.dpdq = res.data.data.licenseVO.address.province.name + res.data.data.licenseVO.address.city.name +
								res.data.data.licenseVO.address.area.name + res.data.data.licenseVO.address.street.name;
							that.dpadr = res.data.data.licenseVO.address.name + res.data.data.licenseVO.address.address;
							that.name = res.data.data.licenseVO.operaName;
						}
					},
					fail: (error) => {
						// this.checks = true
						console.log(error)
					}
				});
			}
		}
	}
</script>

<style>
	.shuru {
		width: 100%;
		height: auto;
		display: block;
		float: left;
		border-radius: 1vw;
		overflow: hidden;
		padding: 2vw 4vw;
		background: #fff;
		margin-top: 3vw;
		box-shadow: 0px 0px 5px #eee;
	}

	.shuru_tit {
		width: 30%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: left;
	}

	.shuru_text {
		width: 60%;
		height: 10vw;
		line-height: 10vw;
		display: block;
		float: right;
		text-align: right;
	}

	.shuru_image {
		width: 10vw;
		height: 10vw;
		display: block;
		float: right;
		border-radius: 2vw;
		overflow: hidden;
		background: #F2F2F2;
		border: 1px solid #F2F2F2;
	}

	image.image {
		width: 100%;
		height: 100%;
	}

	/* .tuic {
		width: 90%;
		height: 14vw;
		display: block;
		float: left;
		text-align: center;
		line-height: 14vw;
		background: url(../../static/img/tuichu.png) no-repeat top center;
		background-size: 100%;
		margin: 0 5%;
		margin-top: 3vw;
	} */
</style>
